package nbcp.db.mongo.repository.sys

import nbcp.base.extend.IsIn
import nbcp.db.mongo.entity.*;
import nbcp.base.extend.*
import nbcp.base.utils.RecursionReturnEnum
import nbcp.base.utils.RecursionUtil
import nbcp.db.mongo.*
import nbcp.db.mongo.entity.MenuDefine
import nbcp.db.mongo.*
import org.springframework.data.mongodb.core.query.Update as CoreUpdate

import  org.springframework.data.mongodb.core.query.Query as CoreQuery;
import nbcp.db.mongo.table.*
/**
 * Created by nbcp on 2017/3/20.
 */

//interface SysUserRepository : MongoRepository<SysUser, ObjectId> {
//    fun findByLoginName(value: String): SysUser?;
//    fun findByStatus(Value: String): SysUser?;
//    fun findByMobile(Value: String): SysUser?;
//}

fun  SystemGroup.SysUserEntity .findByLoginName(value: String): SysUser? {
    return this.query(mor.system.sysUser.loginName match value).toEntity()
}


fun  SystemGroup.SysUserEntity .findByMobile(value: String): SysUser? {
    return this.query(mor.system.sysUser.mobile match value).toEntity()
}


